    //
//  HomeViewController.m
//  SpendFunk
//
//  Created by bm on 4/18/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "HomeViewController.h"
#import "image.h"
#import "SpendFunkAppDelegate.h"

@implementation HomeViewController

// The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.

-(id)init{
	
	return self;
}

// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
	[super loadView];
	[self initView];
}

-(void)initView{
	NSString *path = [NSString stringWithFormat:@"%@",IMG_WELLCOMEBKGR];
	UIImage *img = [UIImage imageNamed:path];
	UIImageView *imgvBkgr = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
	[imgvBkgr setImage:img];
	
	path = [NSString stringWithFormat:@"%@",IMG_BTN_LOGIN];
	NSLog(@"%@",path);
	img = [UIImage imageNamed:path];
	m_pBtnLogin = [[UIButton alloc] initWithFrame:CGRectMake(320/2-img.size.width-4, 480-50-img.size.height, img.size.width, img.size.height)];
	[m_pBtnLogin setImage:img forState:UIControlStateNormal];
	[m_pBtnLogin addTarget:nil action:@selector(onClickLogin) forControlEvents:UIControlEventTouchUpInside];
	[imgvBkgr addSubview:m_pBtnLogin];
	
	path = [NSString stringWithFormat:@"%@",IMG_BTN_SIGNUP];
	img = [UIImage imageNamed:path];
	m_pBtnSignup = [[UIButton alloc] initWithFrame:CGRectMake(320/2+4, 480-50-img.size.height, img.size.width, img.size.height)];
	[m_pBtnSignup setImage:img forState:UIControlStateNormal];	
	[m_pBtnSignup addTarget:nil action:@selector(onClickSignup) forControlEvents:UIControlEventTouchUpInside];
	[imgvBkgr addSubview:m_pBtnSignup];
	
	[imgvBkgr setUserInteractionEnabled:YES];
	[self.view addSubview:imgvBkgr];
	[imgvBkgr release];
}


-(void)onClickLogin{
	[g_AppDelegate openLogin];
}

-(void)onClickSignup{
	[g_AppDelegate openSignup];
}

/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
}
*/

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
